package com.lm.survey.util;

import javax.servlet.http.HttpServletRequest;

import com.lm.survey.model.QuestionGroup;
import com.lm.survey.model.QuestionItem;

public class SeqDisplayHelper {
    public static int getSeq(QuestionItem item,HttpServletRequest request){
        QuestionGroup group = (QuestionGroup)request.getAttribute("group"); 
        if(group.getRandomDisplay()==0){
            return item.getSeq();
        }else{
            Object o = request.getAttribute("SEQ");
            if(o==null){
                request.setAttribute("SEQ",new Integer(1));
                return 1;
            }else{
                int i = ((Integer)o).intValue();
                i++;
                request.setAttribute("SEQ",new Integer(i));
                return i;
                
            }
        }
    }
}
